class Forum < ActiveRecord::Base
    attr_accessible :name, :description
  has_many :topics, :dependent => :destroy
  
  validates_length_of :name, :in => 1..255
  validates_length_of :description, :in => 1..255
  
  def most_recent_post
      topic = Topic.first(:order => 'last_post_at DESC', :conditions => ['forum_id = ?', self.id])
      return topic
  end
end
